package br.edu.unicentro.mymib.base;

import java.text.SimpleDateFormat;
import java.util.TimeZone;

public class Utils {

	private static final class Locale {

		public static final byte LOCALE_BR = 3;
	}

	public final class DateMask {

		// FORMATO DE DATA
		public static final String formatDateTime = "dd/MM/yyyy HH:mm:ss";
		public static final String timeZone = "America/Sao_Paulo";
		public static final byte LC_DEFAULT = Locale.LOCALE_BR;
	}

	private static final TimeZone TIME_ZONE = TimeZone
			.getTimeZone(DateMask.timeZone);

	public static final String formatDateMask(java.util.Date date, String mask) {
		String dateTimeFormat = null;
		try {
			if (mask == null) {
				mask = DateMask.formatDateTime;
			}

			if (date != null) {
				SimpleDateFormat simpleDateFormat = new SimpleDateFormat(mask);
				simpleDateFormat.setTimeZone(TIME_ZONE);

				dateTimeFormat = simpleDateFormat.format(date);

			}
		} catch (Exception e) {
			e.printStackTrace();
		}

		return dateTimeFormat;
	}

}
